<?php

namespace Test\Unit;

use Design\Structural\Registry\Service;
use Design\Structural\Registry\Registry;

class RegistryTest extends \Test\BaseTest
{

    private $service;


    public function setUp(): void
    {
        $this->service = $this->getMockBuilder(Service::class)->getMock();

    }//end setUp()


    public function testSetAndGet()
    {
        Registry::set(Registry::LOGGER, $this->service);

        $this->assertSame($this->service, Registry::get(Registry::LOGGER));

    }//end testSetAndGet()


    public function testThrowSet()
    {
        $this->expectException(\InvalidArgumentException::class);

        Registry::set('foo', $this->service);

    }//end testThrowSet()


    public function testThrowGet()
    {
        $this->expectException(\InvalidArgumentException::class);

        Registry::get('foo');

    }//end testThrowGet()


}//end class
